import axios from 'axios';

const API_BASE_URL = 'http://localhost:5000'; // 后端API地址

export const uploadAvatar = (file) => {
  const formData = new FormData();
  formData.append('file', file);

  return axios.post(`${API_BASE_URL}/api/upload-avatar`, formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  });
};

export const saveAvatarUrl = (url) => {
  return axios.post(`${API_BASE_URL}/api/save-avatar-url`, { avatarUrl: url });
};
